#include <cmath>
#include <iostream>
#include <limits>
using std::cout;
using std::endl;
using std::cin;

void check_stream_status(){
    cout << "goodbit:" << cin.good() << endl
        << "failbit:" << cin.fail() << endl
        << "badbit:" << cin.bad() << endl
        << "eofbit:" << cin.eof() <<endl;
}

void test(){
    int number;
    cin >> number;
    cout << number << endl;
    check_stream_status();
}

void test2(){
    int number;
    while(1){
        cin >> number;
        if(cin.good()){
            cout << "number=" << number <<endl;
            return;
        }else if(cin.fail()){
            cout << "录入不是数字，重新录入："<<endl;
            cin.clear();
            cin.ignore(std::numeric_limits<std::streamsize>::max(),'\n');
        }else if(cin.bad() || cin.eof()){
            cout << "当前流出现问题，暂时无法使用" <<endl;
        }
    }
}

void test4(){
    int number1,number2;
    cin >> number1 >> number2;
    cout << number1 << ":" << number2 << endl;
}

void test5(){
    int number;
    cin >> number;
    if(cin.good()){
        cout << "number=" << number << endl;
    }
    //等价写法：
    if(cin){
        cout << "number=" << number << endl;
    }
}
int main()
{
    test5();

    return 0;
}

